/*
 * Symbol.java
 *
 * Created on July 5, 2006, 8:47 PM
 *
 */

package galronnlp.util;

/**
 *
 * @author Daniel A. Galron
 */
public class Symbol implements Comparable {
    
    private String value;
    private int rep;
    
    /** Creates a new instance of Symbol */
    public Symbol(String v, int r) {
        this.value = v;
        this.rep = r;
    }

    public int compareTo(Object o) {
        Symbol other = (Symbol)o;
        if(this.rep > other.rep)
            return 1;
        else if(this.rep < other.rep)
            return -1;
        else
            return 0;
    }
    
    public boolean equals(Object o) {
        Symbol other = (Symbol)o;
        return this.rep == other.rep;
    }
    
    public String toString() {
        return this.value.toString();
    }
    
    public int hashCode() {
        return this.rep;
    }
    
}
